package com.leetcode;

/**
 * 796. 旋转字符串
 * 模拟法, 其实跟我暴力破解法思想一样
 *
 * @author fy
 * @date 2022/4/7 10:56
 */
public class Solution796_1 {

    public boolean rotateString(String s, String goal) {
        if (s == null || goal == null) {
            return false;
        }
        if (s.length() != goal.length()) {
            return false;
        }
        int n = s.length();

        for (int i = 0; i < n; i++) {
            boolean flag = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != goal.charAt(j)) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                return true;
            }
        }
        return false;
    }
}
